-
Notifications
You must be signed in to change notification settings - Fork 20
feat(ledger): Add friendly string representation of TX outputs #1174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…the eras alonzo, babbage, byron, mary and shelley Signed-off-by: Akhil Repala <[email protected]>
…ted string instead of using a regex Signed-off-by: Akhil Repala <[email protected]>
ledger/alonzo/alonzo_test.go
Outdated
OutputAmount: mary.MaryTransactionOutputValue{Amount: 456, Assets: &ma}, | ||
} | ||
s := out.String() | ||
expected := "(AlonzoTransactionOutput address=" + addr.String() + " amount=456 assets=...)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of converting the address back to string representation, you can split the original string representation at the top to a separate var and compare to that instead. This prevents any weirdness with Address from throwing off the test.
assets := "" | ||
if o.OutputAmount.Assets != nil && len(o.OutputAmount.Assets.Policies()) > 0 { | ||
assets = " assets=..." | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should build out a list of the assets for the string output
ledger/babbage/babbage_test.go
Outdated
OutputAmount: mary.MaryTransactionOutputValue{Amount: 456, Assets: &ma}, | ||
} | ||
s := out.String() | ||
expected := "(BabbageTransactionOutput address=" + addr.String() + " amount=456 assets=...)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
ledger/byron/byron_test.go
Outdated
OutputAmount: 456, | ||
} | ||
s := out.String() | ||
expected := "(ByronTransactionOutput address=" + addr.String() + " amount=456)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
ledger/mary/mary_test.go
Outdated
OutputAmount: MaryTransactionOutputValue{Amount: 456, Assets: &ma}, | ||
} | ||
s := out.String() | ||
expected := fmt.Sprintf("(MaryTransactionOutput address=%s amount=456 assets=...)", addr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
ledger/mary/mary_test.go
Outdated
OutputAmount: MaryTransactionOutputValue{Amount: 456}, | ||
} | ||
errStr := OutputTooBigUtxoError{Outputs: []common.TransactionOutput{out}}.Error() | ||
expected := fmt.Sprintf("output value too large: (MaryTransactionOutput address=%s amount=456)", addr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
ledger/shelley/shelley_test.go
Outdated
OutputAmount: 456, | ||
} | ||
s := out.String() | ||
expected := fmt.Sprintf("(ShelleyTransactionOutput address=%s amount=456)", addr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
ledger/shelley/shelley_test.go
Outdated
OutputAmount: 456, | ||
} | ||
errStr := shelley.OutputTooSmallUtxoError{Outputs: []common.TransactionOutput{out}}.Error() | ||
expected := fmt.Sprintf("output too small: (ShelleyTransactionOutput address=%s amount=456)", addr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the original address string instead of converting Address back to string to avoid potential weirdness
…instead of addr.String() and removed the placeholder for assets Signed-off-by: Akhil Repala <[email protected]>
… golangcilint error Signed-off-by: Akhil Repala <[email protected]>
Closes #958